Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Use absolute file path without project prefix #4292

Merged
merged 1 commit into from
Jul 18, 2024
Merged

Conversation

simonschaufi
Copy link
Collaborator

Resolves: #4291

@simonschaufi simonschaufi merged commit 3e8257f into main Jul 18, 2024
28 checks passed
@simonschaufi simonschaufi deleted the issue-4291 branch July 18, 2024 10:48
@Kanti
Copy link
Contributor

Kanti commented Aug 6, 2024

@simonschaufi
This breaks #4277 again.
can we revert this change or find a Solution for this problem?

@simonschaufi
Copy link
Collaborator Author

As you can see, this is actually a fix for another issue. I wonder why you define the path in the cli and not in rector config?

@Kanti
Copy link
Contributor

Kanti commented Aug 7, 2024

For normal rector execution, I don't need to specify the path in the rector config.
I did not think that I need to define in what path the root of the project is.

I searched the rector.php examples for both rector and typo3-rector and could not find a way to define the path.
How would I define the path?

@simonschaufi
Copy link
Collaborator Author

simonschaufi commented Aug 7, 2024

You don't specify the root path but only the paths in which rector should run, see:
https://github.com/sabbelasichon/typo3-rector/blob/main/templates/rector.php.dist#L17
Rector will then figure out the path by itself.

@Kanti
Copy link
Contributor

Kanti commented Aug 7, 2024

This is a really good piece of info :)

We have a helper in the paths and give all files individually to rector:

$rectorConfig->paths(
    array_filter(explode("\n", (string)shell_exec("git ls-files | xargs ls -d 2>/dev/null | grep -E '\.(php)$'")))
);

It works as you said if I just set the path a directory.

$rectorConfig->paths(
    [__DIR__ . '/src/']
);

But this is not nice if we only have the option to define paths if we want to use typo3-rector.

This also applies to the rector command if you add a filename as a parameter.
e.g:
rector process src/extension/test_extension/ext_tables.php.

Then I still get the error `Unable to create directory at /src/extensions/test_extension/Configuration/TCA/Overrides. mkdir(): Permission denied'. This is also a problem if I only set the directory in the rector config.

@simonschaufi can we have the getcwd() back in the code? or should we find another solution?

@simonschaufi
Copy link
Collaborator Author

If getcwd breaks the code, then we should find another solution or a real fix that doesn't break but I'm not motivated to spend time in this right now as defining the paths works great.

@Kanti
Copy link
Contributor

Kanti commented Sep 6, 2024

I have written a summary in the issue #4301
I will try to find a solution without breaking the usage of the CLI from a different Project path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG]: MoveExtensionManagementUtilityAddStaticFileIntoTCAOverridesRector puts generated file in wrong folder
2 participants